package cn.getech.data.metadata.entity.permission;

import cn.getech.data.development.entity.permission.CollectionTablePermission;
import cn.getech.data.development.entity.permission.SysRoleDataPermission;
import cn.getech.data.metadata.entity.meta.CollectionTableInfo;
import lombok.Data;

import java.util.List;

@Data
public class CollectionTablePermissionExt extends CollectionTablePermission {
    private String securityDataLevel;

    private List<CollectionTableFieldPermission> collectionTableFields;

    public CollectionTablePermissionExt() {
    }

    public CollectionTablePermissionExt(CollectionTableInfo table, SysRoleDataPermission sysRoleDataPermission) {
        if (table != null) {
            setTableName(table.getTableName());
            setTableAsaiName(table.getTableAlias());
            setModuleName(table.getModuleName());
            setSecurityDataLevel(table.getSecurityDataLevel());
            setDataId(table.getId());
        }
        if (sysRoleDataPermission != null) {
            setId(sysRoleDataPermission.getId());
            setQuery(sysRoleDataPermission.getQuery());
            setCreate(sysRoleDataPermission.getCreate());
            setUpdate(sysRoleDataPermission.getUpdate());
            setDelete(sysRoleDataPermission.getDelete());
            setAssign(sysRoleDataPermission.getAssign());
            setDecrypt(sysRoleDataPermission.getDecrypt());
            setExport(sysRoleDataPermission.getExport());
            setRoleId(sysRoleDataPermission.getRoleId());
            setDataType(sysRoleDataPermission.getDataType());
            setId(sysRoleDataPermission.getId());
            setWrite(sysRoleDataPermission.getWrite());
        }
    }

}
